package com.coders.JavaCollections;

import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class LinkedlistExample {
	public static void main(String args[])
	{
		List ll=new LinkedList();
		ll.add("Linked");
		ll.add("List");
		 Iterator i1= ll.iterator();
		 while (i1.hasNext())
		 {
			System.out.print(i1.next()+ " , ") ;
		 }
		 System.out.println();
		 //reversing a linked list
		 Collections.reverse(ll);
		 Iterator i2= ll.iterator();
		 System.out.println("Reversing the list");
		 while (i2.hasNext())
		 {
			System.out.print(i2.next()+ " , ") ;
		 }
	}

}
